package com.ssmdemo.controller.advices;

import com.ssmdemo.dto.R;
import com.ssmdemo.exception.BaseException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author 咕唧
 * @Date 2022/5/24 18:29
 * @Version 1.0
 */
@RestControllerAdvice
public class MyExceptionAdvice {

    @ExceptionHandler(BaseException.class)
    public R processBaseException(BaseException exception){
        exception.printStackTrace();
        return R.setResult(exception.getCode(), exception.getMessage(),null );
    }

}
